package web.Order;

import services.OrdersService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Timestamp;
@WebServlet("/updateOrders")
public class UpdateOrders extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("application/json");
        int court_id = Integer.parseInt(req.getParameter("court_id"));
        Timestamp available_time = Timestamp.valueOf(req.getParameter("available_time"));
        int order_id = Integer.parseInt(req.getParameter("order_id"));
        int num = new OrdersService().updateOrders(court_id, available_time, order_id);
        resp.getWriter().println(num > 0?"修改成功":"修改失败");
    }
}
